<?php
/*
 HIRAPTCHA.INC.PHP by martin $ 2008/06/02 01:10:41
*/
include_once ('../owner/ini.inc.php');
$img_dir = '../Images/';
$hiraptcha = GD2 ? @ImageCreateTrueColor(80, 20) : ImageCreate(80, 20);
$HirEnc = htmlspecialchars($_GET['aim'], ENT_QUOTES);
list($strDec, $_CID) = explode('_', my_decrypt($HirEnc));
$src = ImageCreateFromPNG($img_dir.'bg.png');
ImageCopyResized($hiraptcha, $src, 0, 0, 0, 0, 80, 20, 16, 16);
for($i = 0; $i < 4; $i++){
 $d = cos(M_PI * rand(0, 8)) * rand(0, 3);
 $src = ImageCreateFromPNG($img_dir.'Hira'.$strDec[$i].'.png');
 ImageCopy($hiraptcha, $src, 20 * $i + $d, $d, 0, 0, 20, 20);
}
header('Content-type: image/png');
ImagePNG($hiraptcha);
ImageDestroy($hiraptcha);exit;

function my_decrypt($data, $key=OPASS){
 $data = base64_decode(str_replace(array('_', '-'), array('/', '+'), $data));
 $key = md5($key);
 $keylen = strlen($key);
 for($i = 0; $i < strlen($data); $i++){
  $data[$i] = $data[$i]^$key[$i%$keylen];
 }
 return $data;
}

?>